package project2;

import java.io.Serializable;
import java.net.InetAddress;

public class GPeerInformation implements Serializable{
	private static final long serialVersionUID = -8873905388941596365L;
	public InetAddress address;
	public int port;
	public long id;
	
	public GPeerInformation() {
		id = -1;
	}

	public GPeerInformation(GPeerInformation other) {
		this(other.address, other.port, other.id);
	}
	
	public GPeerInformation(InetAddress address, int port, long id) {
		this.address = address;
		this.port = port;
		this.id = id;
	}
	
	public String toString() {
		return address + ":" + port + " @ " + id;
	}

	public boolean equals(Object other) {
		if (!(other instanceof GPeerInformation))
			return false;
		
		return id == ((GPeerInformation)other).id;
	}
}